///////////////////////////////////////////////////////////////////////////
//  Brainfreeze - Yet another sokoban puzzle game, this time in 3D
//  Copyright (C) 2006 Scott MacDonald
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License along
//  with this program; if not, write to the Free Software Foundation, Inc.,
//  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
///////////////////////////////////////////////////////////////////////////
// GameLevel.h - contains data and methods to deal with a sokoban level
#ifndef __BF_GAMELEVEL_H__
#define __BF_GAMELEVEL_H__
#pragma once

#include "stdafx.h"

class GameLevel
{
public:
	GameLevel(int width, int height, char* leveldef);
	~GameLevel(void);

	bool IsSpaceOccupied(Ogre::Vector3 pos);

	Player&		GetPlayer()	{ return player; }
	std::string Name()		{ return name; }
	int Width()		{ return levelWidth; }
	int Height()	{ return levelHeight; }

	BYTE GetTileType(Ogre::Vector3 pos);

	int GetGoalCount();	
	Ogre::Vector3 GetGoalPos(int index);
	MovableObject& GetGoal(int index);

	int GetBoxCount();
	Ogre::Vector3 GetBoxPos(int index);

	MovableObject& GetBox(Ogre::Vector3 pos);
	MovableObject& GetBox(int index);
	bool HasBox(Ogre::Vector3 pos);

protected:
	int  PointTo1D(Ogre::Vector3 pos) { return pos.y * levelWidth + pos.x; }

private:
	BYTE		*level;			// the tiles in the level
	std::string	name;			// name of the level
	int			levelWidth;		// # of tile across
	int			levelHeight;	// # of tiles down
	Player		player;			// location of the player

	std::vector<MovableObject>	boxes;				// lost of the boxes in the level
	std::vector<MovableObject>	goals;				// list of the goals in the level
};
#endif